-
Notifications
You must be signed in to change notification settings - Fork 184
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Fix inner sum in BGV #513
base: main
Are you sure you want to change the base?
Fix inner sum in BGV #513
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I would rename rlwe.Evaluator.PartialTrace
to rlwe.Evaluator.PartialTracesSum
or something similar because here we have an accumulator accQP
that sums HW(n) partial traces. It's only when n is a power of two (where HW(n) = 1) and offset divides n that we have a true partial Trace (in the sens that full trace is from 0 to LogN and partial means from a to b where 0<= a < b <= logN). In other words, .Trace is a special case of PartialTracesSum
.
Else I'm happy with the proposed solution.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm happy with this solution
Yes I agree, it is a partial trace in the sense that it is a sum with a subset of the automorphisms, but you're right that |
Refactor of the inner sum API in lattigo. Fixes #510.
Issue
bgv.Evaluator.InnerSum
was not working properly whenn*batchSize = N
(whereN
is the number of slots) asInnerSum
was acting separately on the "rows" of the underlying plaintext.It has been decided to refactor the whole InnerSum API in lattigo to be more coherent.
Changes
rlwe.Evaluator.InnerSum
has been replaced byrlwe.Evaluator.PartialTrace
to reflect that at the level ofrlwe
the notion of inner sum does not exist.bgv.Evaluator.InnerSum
andckks.Evaluator.InnerSum
methods, which have the same behaviour as the oldInnerSum
method for parametersn
andbatchSize
s.t.0 < n*batchSize <= ctIn.Slots()
divides the number of slots. Parameters not satisfying these conditions are rejected.bgv.Evaluator.RotateAndAdd
andckks.Evaluator.RotateAndAdd
methods, which have the same behaviour as the oldInnerSum
method for all parameters.In summary, #510 is fixed, legacy code is still supported except when
n*batchSize
does not divide the number of slots (or ifn*batchSize
is not in the interval[1, ctIn.Slots()]
). In that case,RotateAndAdd
must be used.